package com.zy.shopproject2.usercenter.entity

import com.google.gson.Gson
import com.google.gson.internal.LinkedTreeMap

/**
 *@author:zhangyue
 *@date:2020/5/28
 */
class BaseResponseEntity {
    var code:Int = 0
        get() {
            return field
        }
    var data:Any? = null
        get() {
            if (field is String && field == null){
                return null
            }
            return field
        }
    var msg:String = ""

    inline fun <reified T> getValue():T?{
        if(data is LinkedTreeMap<*,*>){
            return Gson().fromJson(Gson().toJson(data),T::class.java)
        }
        return null
    }
}